﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Portal.Nhibernate.Repository;

namespace Portal.Web.Admin.Setting
{
    public partial class SalesNetworkControl : AdminBasePage
    {
     /// <summary>
        /// 获取设置数据仓库
        /// </summary>
        private readonly ISettingRepository<ISetting> _settingRepository;
        /// <summary>
        /// 获取当语言前设置
        /// </summary>
        private ISetting _setting;
        private readonly IList<ISetting> _settingList;
        public SalesNetworkControl()
        {
            _settingList = SettingCache.GetList();
            _settingRepository = new SettingRepository();


        }
        public ISetting Model { get { return _setting; } }

        protected void Page_Load(object sender, EventArgs e)
        {
            var seting = _settingList.FirstOrDefault(o => o.Culture == culture) ?? _settingRepository.CreateEntity();
            seting.Culture = culture;
            _setting = seting;
        }
    }
}